﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AlgoTester
{
    class World
    {
        // Data Members
        private Date day;
        private List<Stockmarket> marketList;
        private List<Trader> traderList;

        // Constructor
        public World(int day, int month, int year)
        {
            this.day = new Date(day, month, year);
            this.marketList = new List<Stockmarket>();
            this.traderList = new List<Trader>();
        }

        // Constructor Overload
        public World(Date day)
        {
            this.day = day;
            this.marketList = new List<Stockmarket>();
            this.traderList = new List<Trader>();
        }

        // Main simulation driver
        // Call from Main to run program
        public void nextDay()
        {
            day.increment();
            // Call next day for each market
            foreach (Stockmarket nextMarket in marketList)
                nextMarket.nextDay(day);
            // Call next day for each trader
            foreach (Trader nextTrader in traderList)
            {
                nextTrader.nextDay(day);
            }
            return;
        }

        // Add a Stockmarket to the world
        public void addStockmarket(Stockmarket newMarket)
        {
            marketList.Add(newMarket);
        }

        // Add a Trader to the world
        public void addTrader(Trader newTrader)
        {
            traderList.Add(newTrader);
        }

    }
}
